package com.kzj.laimeimei.recyclerCard.cardView;

import android.content.Context;
import android.support.v4.view.ViewPager;
import android.util.AttributeSet;

import com.kzj.laimeimei.R;
import com.kzj.laimeimei.adapter.ViewsPagerAdapter;
import com.kzj.laimeimei.recyclerCard.basic.CardItemView;
import com.kzj.laimeimei.recyclerCard.card.fragmentMain.ViewPagerCard;
import com.kzj.laimeimei.widget.CirclePageIndicator;

/**
 * Created by xyg on 2015/10/26.
 */
public class ViewPagerCardView extends CardItemView<ViewPagerCard> {

    private Context context;
    private ViewPager viewPager;
    private CirclePageIndicator circlePageIndicator;
    public ViewPagerCardView(Context context, AttributeSet attrs, int defStyle) {
        super(context, attrs, defStyle);
    }

    public ViewPagerCardView(Context context) {
        super(context);
        this.context = context;
    }

    public ViewPagerCardView(Context context, AttributeSet attrs) {
        super(context, attrs);
        this.context = context;
    }

    @Override
    public void build(ViewPagerCard card) {
        super.build(card);
        viewPager=(ViewPager)findViewById(R.id.viewPager);
        circlePageIndicator= (CirclePageIndicator) findViewById(R.id.circlePageIndicator);
        ViewsPagerAdapter viewsPagerAdapter=new ViewsPagerAdapter(card.getAdBeanList(),context);

        viewPager.setAdapter(viewsPagerAdapter);
        circlePageIndicator.setViewPager(viewPager);
        circlePageIndicator.setFillColor(context.getResources().getColor(R.color.color_f875a3_red));
    }
}
